package com.tudu.day02.oop;

/**
 * instanceof关键字---继承----多态---判断类是否造型
 */
class Name{}
class ReName extends Name{}
public class Instanceof关键字 {
    public static void main(String[] args){
        Name name=new Name();
        System.out.println(name instanceof Name);    //true
        System.out.println(name instanceof ReName);  //folse


        //继承--创建出来---关系---向上造型
        Name a=new ReName();
        System.out.println(a instanceof Name);   //true
        System.out.println(a instanceof ReName);//true]\                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   ,
    }
}
